package com.bw.zg3park2212.adpter

import android.widget.TextView
import com.bw.base.entity.TaskEntityItem
import com.bw.zg3park2212.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class TaskAdpter :BaseQuickAdapter<TaskEntityItem,BaseViewHolder>(R.layout.item_task){
    override fun convert(helper: BaseViewHolder, item: TaskEntityItem) {
        helper.setText(R.id.task_Name,item.taskName)
       // helper.setText(R.id.task_type,item.patrolStatus)
        helper.setText(R.id.task_time,"任务时间："+item.patrolTime)
        val type = helper.getView<TextView>(R.id.task_type)
        if(item.patrolStatus=="0"){
            type.setBackgroundResource(R.drawable.bg_kongxian)
            type.setTextColor(context.getColor(R.color.color_kongxian))
            type.setText("未巡检")
        }else if(item.patrolStatus=="1"){
            type.setBackgroundResource(R.drawable.bg_zganyong)
            type.setTextColor(context.getColor(R.color.color_zhanyong))
            type.setText("巡检中")
        }else if(item.patrolStatus=="2"){
            type.setBackgroundResource(R.drawable.bg_weihu)
            type.setTextColor(context.getColor(R.color.color_weihu))
            type.setText("已完成")
        }else{
            type.setBackgroundResource(R.drawable.bg_hui)
            type.setTextColor(context.getColor(R.color.color_hui))
            type.setText("已作废")
        }
    }
}